#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>
#include <set>

using namespace std;



void test0(){
    int num = 10;
    int age = 60;
    string name("name");

    auto f1 = [&]()->void{
        cout << ++num << endl;
        cout << ++age << endl;
        cout << name << endl;
    };
    f1();

    /**
     * name值传递，其余引用传递
     */
    auto f2 = [& ,name]()->void{
        cout << ++num << endl;
        cout << ++age << endl;
        cout << name << endl;
    };
    f2();

    /**
     * name引用传递，其余值传递
     */
    auto f3 = [=, &name]()->void{
        cout << num << endl;
        cout << age << endl;
        cout << name << endl;
    };
    f3();
}

int main() {
    test0();
    return 0;
}
